/**
 * 首页展示。绑定Reducer和Action，到当前界面。
 */
import MainViewComponent from "../components/MainViewComponent";
import * as actions from "../actions/action";
import React from "react";
import { connect } from "react-redux";
import { bindActionCreators } from "redux";
import { Ids } from "../../index";

class MainPageContainer extends React.Component {
  constructor(props: any) {
    super(props);
  }
  render() {
    return <MainViewComponent {...this.props} componentId={Ids.MAIN_PAGE} />;
  }
}

// 将Reducer中的数据拿出来
const mapStateToProps = (state: any) => {
  return { state: state.reducer };
};
// 将Action函数注入到props
const mapDispatchToProps = (dispatch: any) => ({
  actions: bindActionCreators(actions, dispatch),
});
export default connect(mapStateToProps, mapDispatchToProps)(MainPageContainer);
